<template>
    <div>
        <!-- 编程式导航 -->
        <p>
            <span @click="$router.push('/router/news')">新闻</span>
            <span @click="gotoFn">体育</span>
        </p>
        <router-view></router-view>
    </div>
</template>

<script setup>
import { useRoute, useRouter } from 'vue-router'
// console.log(useRoute, useRouter);
const router = useRouter()
const gotoFn = () => {
    // 
    // console.log('this', this); // undefined
    router.push({
        path: '/router/sport',
        query: {
            name: '小李子'
        }
    })
}



</script>
<style scoped></style>